package com.feng.oauth2jwt.oauth.infrastructure;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 日期处理工具类
 *
 */
public abstract class DateUtils {

    public static final String DEFAULT_DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";


    /**
     * Private constructor
     */
    private DateUtils() {
    }

    public static Timestamp now() {
         return new Timestamp(new Date().getTime());
    }


    public static String toDateTime(Timestamp date) {
        return toDateTime(date, DEFAULT_DATE_TIME_FORMAT);
    }

    public static String toDateTime(Timestamp dateTime, String pattern) {
        SimpleDateFormat dateFormat=new SimpleDateFormat(pattern);
        return dateFormat.format(dateTime);
    }
    

}